{% extends "base.html" %}

{% block content %}
<div class="container py-4">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card shadow-sm">
                <div class="card-body">
                    <h2 class="card-title mb-4">个人设置</h2>
                    
                    <!-- 设置导航 -->
                    <ul class="nav nav-tabs mb-4">
                        <li class="nav-item">
                            <a class="nav-link active" href="{{ url_for('main.settings') }}">个人信息</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="{{ url_for('main.change_password') }}">修改密码</a>
                        </li>
                    </ul>

                    <form method="post">
                        <div class="row g-3">
                            <div class="col-md-6">
                                <label for="username" class="form-label">用户名</label>
                                <input type="text" class="form-control" id="username" value="{{ current_user.username }}" disabled>
                            </div>
                            <div class="col-md-6">
                                <label for="email" class="form-label">邮箱</label>
                                <input type="email" class="form-control" id="email" value="{{ current_user.email }}" disabled>
                            </div>
                            <div class="col-md-6">
                                <label for="height" class="form-label">身高 (cm)</label>
                                <input type="number" class="form-control" id="height" name="height" 
                                       value="{{ current_user.height or '' }}" min="100" max="250" step="0.1">
                            </div>
                            <div class="col-md-6">
                                <label for="target_weight" class="form-label">目标体重 (kg)</label>
                                <input type="number" class="form-control" id="target_weight" name="target_weight" 
                                       value="{{ current_user.target_weight or '' }}" min="30" max="200" step="0.1">
                            </div>
                            <div class="col-md-6">
                                <label for="gender" class="form-label">性别</label>
                                <select class="form-select" id="gender" name="gender">
                                    <option value="">请选择</option>
                                    <option value="男" {% if current_user.gender == '男' %}selected{% endif %}>男</option>
                                    <option value="女" {% if current_user.gender == '女' %}selected{% endif %}>女</option>
                                </select>
                            </div>
                            <div class="col-md-6">
                                <label for="birth_date" class="form-label">出生日期</label>
                                <input type="date" class="form-control" id="birth_date" name="birth_date" 
                                       value="{{ current_user.birth_date.strftime('%Y-%m-%d') if current_user.birth_date else '' }}">
                            </div>
                            <div class="col-12">
                                <div class="d-grid gap-2">
                                    <button type="submit" class="btn btn-primary">保存更改</button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 